/************************************************************
* @file   gkt_flash_partition.h
************************************************************/

#ifndef GKT_FLASH_PARTITION_H
#define GKT_FLASH_PARTITION_H

#include "gkt_flash.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct _gkt_flash_partition_info {
	int	id;
	uint32_t	sector_size;
	uint32_t	size;
	const void	*read_map_addr;
} gkt_flash_partition_info_s;

int gkt_flash_partition_init(void);

const gkt_flash_partition_info_s 
	*gkt_flash_partition_get_info(const char *name);

int gkt_flash_partition_read(int id,
			uint32_t offset, uint32_t size, 
			void *buffer);

int gkt_flash_partition_write(int id,
			uint32_t offset, uint32_t size, 
			const void *data, int pre_erase);

int gkt_flash_partition_erase(int id,
			uint32_t offset, uint32_t size);

int gkt_flash_partition_erase_all(int id);

#ifdef __cplusplus
}
#endif

#endif	/* GKT_FLASH_PARTITION_H */

